package com.ljh.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ljh.mapper.SongMapper;
import com.ljh.pojo.Song;
import com.ljh.service.SongService;
import com.ljh.utils.Result;
import com.ljh.vo.SexVo;
import com.ljh.vo.SongListVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

@Service
public class SongServiceImpl extends ServiceImpl<SongMapper,Song> implements SongService {

    @Autowired
    SongMapper songMapper;

    @Override
    public List<Song> findNineSongs(Integer num) {
        List<Song> allSongs = songMapper.findNine(num);
        return allSongs;
    }

    @Override
    public Song findSongById(Integer id) {
        return songMapper.findSongById(id);
    }

    @Override
    public void updateSongNum(Integer num, Integer id) {
        songMapper.updateSongNum(num,id);
    }

    @Override
    public List<Song> findHost15() {
        return songMapper.findHost15();
    }

    @Override
    public List<Song> findNew15() {
        return songMapper.findNew15();
    }

    @Override
    public List<Song> findMohu(String str) {
        str = "%"+str+"%";
        return songMapper.findMoHU(str);
    }

    @Override
    public List<SongListVo> findSongListByStyle2(String style) {
        return songMapper.findSongListByStyle2(style);
    }

    @Override
    public void deleteUserByCollid(Integer collId) {
        songMapper.deleteUserByCollid(collId);
    }

    @Override
    public List<Song> findSongsByCollId(Integer id) {
        return songMapper.findSongsByCollId(id);
    }

    /**
     * 删除中加表的数据
     * @param songId
     */
    @Override
    public void deleteListSongBySongId(Integer songId) {
        songMapper.deleteListSongBySongId(songId);
    }

    @Override
    public void deleteSongById(Integer songId) {
        songMapper.deleteSongById(songId);
    }

    @Override
    public List<Song> findSongBySongId(Integer songId) {
        return songMapper.findSongBySongId(songId);
    }

    @Override
    public void UpdatePersonPhoto(String songPhoto, Integer songId) {
        songMapper.UpdatePersonPhoto(songPhoto, songId);
    }

    @Override
    public void updateSong(String songPhoto, Integer songId) {
        songMapper.updateSong(songPhoto, songId);
    }

    @Override
    public void insertSong(String singerName, Integer singerId, String songName, String songStyle) {
        songMapper.insertSong(singerName, singerId, songName, songStyle);
    }

    @Override
    public List<Song> findSongByCollIdNull() {
        List<Song> songByCollIdNull = songMapper.findSongByCollIdNull();
        return songByCollIdNull;

    }

    @Override
    public void insertColl(Integer collId, String collName, Integer songId,String collPhoto) {
        songMapper.insertColl(collId, collName, songId,collPhoto);
    }

    @Override
    public List<SexVo> findSongStyle() {
        return songMapper.findSongStyle();
    }

    @Override
    public List<SexVo> findSingerHot() {
        return songMapper.findSingerHot();
    }

    @Override
    public List<SexVo> findHotSong() {
        return songMapper.findHotSong();
    }
}
